using IronBarCode;
using IronSoftware.Drawing;
// Create a barcode
var myBarcode = BarcodeWriter.CreateBarcode("12345", BarcodeWriterEncoding.EAN8);
// Resize in pixels
myBarcode.ResizeTo(400, 100);
// Set margins in pixels
myBarcode.SetMargins(5, 5, 5, 5);
// Set the color of the barcode
myBarcode.ChangeBarCodeColor(Color.Red);
// And save our barcode as an image:
myBarcode.SaveAsImage("EAN8.jpeg");
// Another supported feature is Mil Sizing
// Mil is a measurement unit used by the barcode scanner manufacturers to specify the minimum of one barcode bar, and at what distance the barcode can be scanned.
// It represents (1 / 1000)th of an inch
var barcodeResizeInMils = BarcodeWriter.CreateBarcode("5941623002802", BarcodeEncoding.Code128);
// This will resize the barcode width to 13 mil, at 96 DPI by default
barcodeResizeInMils.ResizeToMil(13);
// This will resize the barcode width to 10 mil and and the height to 1.5 inches, at 96 DPI by default
barcodeResizeInMils.ResizeToMil(10, 1.5);
// This will resize the barcode width to 7.5 mil and the height to 2 inches, with the DPI set to 200
barcodeResizeInMils.ResizeToMil(7.5, 2, 200);
Imports IronBarCode
Imports IronSoftware.Drawing
' Create a barcode
Private myBarcode = BarcodeWriter.CreateBarcode("12345", BarcodeWriterEncoding.EAN8)
' Resize in pixels
myBarcode.ResizeTo(400, 100)
' Set margins in pixels
myBarcode.SetMargins(5, 5, 5, 5)
' Set the color of the barcode
myBarcode.ChangeBarCodeColor(Color.Red)
' And save our barcode as an image:
myBarcode.SaveAsImage("EAN8.jpeg")
' Another supported feature is Mil Sizing
' Mil is a measurement unit used by the barcode scanner manufacturers to specify the minimum of one barcode bar, and at what distance the barcode can be scanned.
' It represents (1 / 1000)th of an inch
Dim barcodeResizeInMils = BarcodeWriter.CreateBarcode("5941623002802", BarcodeEncoding.Code128)
' This will resize the barcode width to 13 mil, at 96 DPI by default
barcodeResizeInMils.ResizeToMil(13)
' This will resize the barcode width to 10 mil and and the height to 1.5 inches, at 96 DPI by default
barcodeResizeInMils.ResizeToMil(10, 1.5)
' This will resize the barcode width to 7.5 mil and the height to 2 inches, with the DPI set to 200
barcodeResizeInMils.ResizeToMil(7.5, 2, 200)
Install-Package BarCode
Personnaliser Barcode
Dans IronBarcode, vous avez la flexibilité de redimensionner les codes-barres, d'ajouter des marges, de changer les couleurs, et de les enregistrer dans différents formats de fichier populaires. De plus, vous pouvez ajuster les paramètres DPI pour obtenir un contrôle plus précis sur les détails de l'image.
Personnalisation de l'apparence du code-barres : Diverses méthodes permettent de modifier la taille et les couleurs du code-barres :
ResizeTo(500, 500): Redimensionne le code-barres à 500x500 pixels.
ChangeBarColor: Modifie la couleur des barres du code-barres.
Votre clé d'essai devrait être dans l'e-mail. Si elle ne l'est pas, veuillez contacter support@ironsoftware.com
Rejoignez les millions d'ingénieurs qui ont essayé IronPDF
Votre clé d'essai devrait être dans l'e-mail. Si elle ne l'est pas, veuillez contacter support@ironsoftware.com
Parlez à l'Équipe de Vente
Réservez une Consultation sans Engagement
Comment pouvons-nous vous aider :
Consultez votre flux de travail et vos points de douleur
Voyez comment d'autres entreprises répondent à leurs besoins en matière de documents .NET
Toutes vos questions reçoivent une réponse pour vous assurer d'avoir toutes les informations nécessaires. (Aucun engagement de quelque nature que ce soit.)
Obtenez un devis personnalisé pour les besoins de votre projet